package com.yz.jdd.webview;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;

import java.util.Map;

public class H5PostCallBack {
	@Expose
	private String cmd;
	@Expose
	private String code;
	@Expose
	private String msg;
	@Expose
	private boolean success;
    @Expose
	private Object resultObject;
	public void setCmd(String cmd) {
		this.cmd = cmd;
	}

	public void setResultObject(Object resultObject) {
		this.resultObject = resultObject;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String toJSON() {
		Gson gson = new GsonBuilder().serializeNulls()
//				.excludeFieldsWithoutExposeAnnotation()
				.disableHtmlEscaping()
				.create();

//		GsonBuilder builder = new GsonBuilder();
		/*如果不设置serializeNulls,序列化时默认忽略NULL*/
//      builder.serializeNulls();   // 1

		return gson.toJson(this);
	}
	
	
}
